class Contact {
  final String name;
  final String phone;
  final String avatar;

  Contact({
    required this.name,
    required this.phone,
    required this.avatar,
  });

  // 从 JSON 创建联系人对象
  factory Contact.fromJson(Map<String, dynamic> json) {
    return Contact(
      name: json['name'] as String,
      phone: json['phone'] as String,
      avatar: json['avatar'] as String,
    );
  }

  // 将联系人对象转换为 JSON
  Map<String, dynamic> toJson() {
    return {
      'name': name,
      'phone': phone,
      'avatar': avatar,
    };
  }
} 